local Body = class("Body")

function Body:ctor(snake, x, y, node, isHead)
    self.snake = snake
    self.x = x
    self.y = y

    if isHead then
    	self.sp = cc.Sprite:create("head.png")
    else
    	self.sp = cc.Sprite:create("body.png")
    end

    node:addChild(self.sp)
    self:Update()
end

--把逻辑的网格位置转为显示的图形位置
function Body:Update( )
   local posx, posy = Grid2Pos(self.x, self.y)
   self.sp:setPosition(posx, posy)
end

return Body